Add Agent Host session configuration flow#309240
Conversation
a8b52bf to
8d5f0f3
Compare
There was a problem hiding this comment.
Pull request overview
Adds an Agent Host–driven “session configuration” flow for new session creation, wiring protocol support through the agent host server/client layers and surfacing schema-driven pickers in the Agents (sessions) window. Also forwards the resolved config into session creation and uses it (for Copilot) to drive worktree/branch setup.
Changes:
- Add AHP protocol + service APIs for
resolveSessionConfigandsessionConfigCompletions, and persist resolved config into session state. - Introduce dynamic, schema-driven session config pickers in the Sessions (Agents) UI and forward config through chat request → session handler → agent host
createSession. - Add Copilot git integration via a new
IAgentHostGitService, including branch completions and optional worktree creation/cleanup based on resolved config.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts | Updates mock agent connection to satisfy new config-resolution APIs. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds coverage ensuring request config is forwarded into agent host createSession. |
| src/vs/workbench/contrib/chat/common/participants/chatAgents.ts | Extends IChatAgentRequest with agentHostSessionConfig. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Plumbs agentHostSessionConfig from send options into requests. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Extends IChatSendRequestOptions with agentHostSessionConfig. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts | Adds logging wrappers for the new config commands. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Forwards request config to agent host session creation. |
| src/vs/sessions/sessions.common.main.ts | Registers the new session-config picker contribution in the Sessions app. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Adds optional provider hooks/events for dynamic “new session” config state. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Clears abandoned new-session config when switching away from an untitled session. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Implements dynamic config state for remote agent host new sessions and forwards config on send. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Implements dynamic config state for local agent host new sessions and forwards config on send. |
| src/vs/sessions/contrib/chat/browser/newChatViewPane.ts | Disables send while config is unresolved; listens for provider config changes. |
| src/vs/sessions/contrib/chat/browser/media/agentHostSessionConfigPicker.css | Styles container for the new config picker UI. |
| src/vs/sessions/contrib/chat/browser/agentHostSessionConfigPicker.ts | Adds schema-driven config pickers (static enum + dynamic completions). |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Updates mock agent service with new config-resolution APIs. |
| src/vs/platform/agentHost/test/node/protocol/testHelpers.ts | Allows starting test server without --quiet (for server startup test). |
| src/vs/platform/agentHost/test/node/protocol/sessionConfig.integrationTest.ts | New integration tests for config resolve/completions and state persistence. |
| src/vs/platform/agentHost/test/node/protocol/agentHostServer.integrationTest.ts | New integration test verifying server boots with production services. |
| src/vs/platform/agentHost/test/node/mockAgent.ts | Adds scripted mock support for config resolve/completions. |
| src/vs/platform/agentHost/test/node/copilotGitProject.test.ts | Refactors tests to use IAgentHostGitService instead of spawning git. |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Adds test that session creation stores resolved config into live state. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Adds JSON-RPC handlers for config resolve/completions and forwards config to createSession. |
| src/vs/platform/agentHost/node/copilot/copilotGitProject.ts | Switches git project detection to IAgentHostGitService. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Implements config schema + branch completions and worktree creation/cleanup. |
| src/vs/platform/agentHost/node/agentService.ts | Persists resolved config into session state; exposes config APIs on the service. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Registers IAgentHostGitService for server mode. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Registers IAgentHostGitService for utility-process mode. |
| src/vs/platform/agentHost/node/agentHostGitService.ts | New git service providing repo/branch/worktree operations via git CLI. |
| src/vs/platform/agentHost/electron-browser/remoteAgentHostProtocolClient.ts | Adds client calls for config resolve/completions; forwards config into createSession. |
| src/vs/platform/agentHost/electron-browser/agentHostService.ts | Adds IPC proxy methods for config resolve/completions. |
| src/vs/platform/agentHost/common/state/sessionState.ts | Re-exports new session config types (currently with a duplication bug). |
| src/vs/platform/agentHost/common/state/protocol/version/registry.ts | Marks session/configChanged action as introduced in v1. |
| src/vs/platform/agentHost/common/state/protocol/state.ts | Adds config?: ISessionConfigState to session state and defines config schema types. |
| src/vs/platform/agentHost/common/state/protocol/reducers.ts | Reducer merges session/configChanged values into session config state. |
| src/vs/platform/agentHost/common/state/protocol/messages.ts | Adds command map entries for resolveSessionConfig and sessionConfigCompletions. |
| src/vs/platform/agentHost/common/state/protocol/commands.ts | Adds protocol params/results for config resolve/completions and createSession.config. |
| src/vs/platform/agentHost/common/state/protocol/actions.ts | Adds SessionConfigChanged action type and interface. |
| src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts | Updates generated action-origin metadata for new action. |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Updates pinned AHP protocol revision. |
| src/vs/platform/agentHost/common/agentService.ts | Extends agent service interfaces with config APIs and createSession.config. |
Copilot's findings
- Files reviewed: 41/41 changed files
- Comments generated: 4
4564f56 to
0779100
Compare
(Written by Copilot)
0779100 to
5a3a2c7
Compare
… into roblou/agent-host-session-config # Conflicts: # src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts # src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts
There was a problem hiding this comment.
Pull request overview
Adds end-to-end “session configuration” support for Agent Host-backed sessions, wiring new protocol commands through to the Agents window UI so users can pick schema-driven configuration before creating a session (and forwarding the resolved config into session creation, including Copilot worktree/branch setup).
Changes:
- Introduces Agent Host Protocol commands for resolving session config schema (
resolveSessionConfig) and dynamic value completions (sessionConfigCompletions), and plumbs them through client/server implementations. - Adds dynamic session type discovery (from host
rootState.agents) for local + remote Agent Host providers, including runtime session type updates. - Adds a Sessions window UI contribution that renders schema-driven config pickers and forwards resolved config into chat/session creation.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts | Updates mock agent connection to implement new session-config protocol methods. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Extends request plumbing/tests to include agentHostSessionConfig forwarded into session creation. |
| src/vs/workbench/contrib/chat/common/participants/chatAgents.ts | Adds agentHostSessionConfig to IChatAgentRequest. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Propagates agentHostSessionConfig from send options into requests. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Adds agentHostSessionConfig to IChatSendRequestOptions. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts | Adds logging wrappers for rootState + new session-config RPCs. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Forwards agentHostSessionConfig into Agent Host createSession calls. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Fixes model provider registration order so initial change events are observed. |
| src/vs/sessions/sessions.common.main.ts | Registers new Sessions-window UI contribution for session config picker. |
| src/vs/sessions/SESSIONS_PROVIDER.md | Updates documentation for remote agent host provider identity + dynamic agent discovery. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Extends provider interface with optional dynamic session types + dynamic session-config APIs. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Reacts to dynamic session type changes and clears draft session config when leaving untitled sessions. |
| src/vs/sessions/contrib/remoteAgentHost/test/common/remoteAgentHostSessionType.test.ts | Adds tests pinning remote session type id wire format. |
| src/vs/sessions/contrib/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Updates/expands tests for dynamic agent discovery and session type behavior. |
| src/vs/sessions/contrib/remoteAgentHost/common/remoteAgentHostSessionType.ts | Adds helper to generate remote agent host session type IDs. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Implements dynamic session types from rootState.agents and dynamic new-session config resolution/completions. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Registers agents dynamically (no longer Copilot-only) and uses unified session type id helper. |
| src/vs/sessions/contrib/localAgentHost/test/browser/localAgentHostSessionsProvider.test.ts | Updates/expands tests for dynamic session types + session type switching behavior. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Implements dynamic session types from rootState.agents plus dynamic new-session config resolution/completions. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHost.contribution.ts | Updates working directory resolver registration to track dynamic session types. |
| src/vs/sessions/contrib/chat/browser/sessionTypePicker.ts | Refreshes session type picker when providers’ session types change at runtime. |
| src/vs/sessions/contrib/chat/browser/newChatViewPane.ts | Disables send when session config is not “ready” and watches providers for config changes. |
| src/vs/sessions/contrib/chat/browser/media/agentHostSessionConfigPicker.css | Adds styling for session config picker container. |
| src/vs/sessions/contrib/chat/browser/agentHostSessionConfigPicker.ts | Adds schema-driven config picker UI contribution (enum + dynamic completions). |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Updates protocol handler tests to include new session-config RPCs. |
| src/vs/platform/agentHost/test/node/protocol/testHelpers.ts | Extends server start helper to optionally disable --quiet. |
| src/vs/platform/agentHost/test/node/protocol/sessionConfig.integrationTest.ts | Adds integration tests for session config RPCs + session state persistence/merge behavior. |
| src/vs/platform/agentHost/test/node/protocol/agentHostServer.integrationTest.ts | Adds integration test validating server starts with production agent services registered. |
| src/vs/platform/agentHost/test/node/mockAgent.ts | Extends mock agents to implement session config resolution + completions for tests. |
| src/vs/platform/agentHost/test/node/copilotGitProject.test.ts | Refactors git project resolution tests to use a git service abstraction (no real git exec). |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Adds test ensuring created sessions persist resolved config in session state. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Plumbs new RPCs and forwards config into createSession. |
| src/vs/platform/agentHost/node/copilot/copilotGitProject.ts | Replaces direct git exec with IAgentHostGitService abstraction. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Implements session config schema resolution + branch completions; adds worktree creation/cleanup based on resolved config. |
| src/vs/platform/agentHost/node/agentService.ts | Persists resolved session config into protocol session state; exposes resolve/completions APIs. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Registers AgentHostGitService so CopilotAgent can query git state/create worktrees. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Registers AgentHostGitService in utility process entrypoint. |
| src/vs/platform/agentHost/node/agentHostGitService.ts | Introduces git service abstraction for querying branches/worktrees and managing worktrees. |
| src/vs/platform/agentHost/electron-browser/remoteAgentHostProtocolClient.ts | Adds client RPCs for session config resolution + completions; forwards config on createSession. |
| src/vs/platform/agentHost/electron-browser/agentHostService.ts | Extends IPC proxy surface with resolve/completions methods. |
| src/vs/platform/agentHost/common/state/sessionState.ts | Re-exports ISessionConfigState. |
| src/vs/platform/agentHost/common/state/protocol/version/registry.ts | Marks SessionConfigChanged action as introduced in protocol v1. |
| src/vs/platform/agentHost/common/state/protocol/state.ts | Adds session config schema/value types and attaches config to session state. |
| src/vs/platform/agentHost/common/state/protocol/reducers.ts | Adds reducer handling for session/configChanged. |
| src/vs/platform/agentHost/common/state/protocol/messages.ts | Adds new RPCs to the command map. |
| src/vs/platform/agentHost/common/state/protocol/commands.ts | Adds createSession config param + defines resolve/completions command contracts. |
| src/vs/platform/agentHost/common/state/protocol/actions.ts | Adds SessionConfigChanged action shape to protocol actions union. |
| src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts | Updates generated action unions/dispatchability for session config changes. |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Updates vendored AHP protocol version hash. |
| src/vs/platform/agentHost/common/agentService.ts | Extends common agent APIs to include session config resolution/completions + createSession config. |
Copilot's findings
- Files reviewed: 50/50 changed files
- Comments generated: 2
src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts
Show resolved
Hide resolved
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts
Show resolved
Hide resolved
Written by Copilot
Written by Copilot
Written by Copilot
(Written by Copilot)
(Written by Copilot)
(Written by Copilot)
There was a problem hiding this comment.
Pull request overview
Adds Agent Host “session configuration” as a first-class flow for creating new sessions: the protocol exposes schema + dynamic completions, the Sessions (Agents) window renders schema-driven pickers, and the resolved config is forwarded through chat request plumbing into Agent Host session creation (including Copilot worktree/branch behavior).
Changes:
- Add protocol commands for resolving session config schema and fetching dynamic completions; persist resolved config on session state.
- Add Sessions-window UI + provider APIs for dynamic, schema-driven session configuration during “new session” creation; block sending until config is ready.
- Forward resolved session config into session creation across local/remote Agent Host providers; add Copilot worktree/branch setup derived from config and request text hints.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts | Updates test mock connection to implement new session-config RPCs. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds coverage for forwarding session config + deterministic branch-name hint derivation. |
| src/vs/workbench/contrib/chat/common/participants/chatAgents.ts | Extends chat agent request shape with agentHostSessionConfig. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Plumbs agentHostSessionConfig from send options into agent requests. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Adds agentHostSessionConfig to chat send options API surface. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts | Logs rootState subscription changes and proxies new config RPCs with logging. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Forwards session config to createSession and injects a branch-name hint derived from first prompt. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Exports branch-hint helper; fixes model-provider registration/update ordering. |
| src/vs/sessions/sessions.common.main.ts | Wires in the new session config picker contribution for the Sessions app. |
| src/vs/sessions/SESSIONS_PROVIDER.md | Updates provider identity + remote agent host architecture documentation for dynamic agent discovery. |
| src/vs/sessions/services/sessions/common/sessionsProvider.ts | Extends provider API for dynamic session types + dynamic session configuration lifecycle. |
| src/vs/sessions/services/sessions/browser/sessionsManagementService.ts | Listens for session-type changes and clears pending new-session config when switching away. |
| src/vs/sessions/contrib/remoteAgentHost/test/common/remoteAgentHostSessionType.test.ts | Adds a unit test pinning remote session type “wire format”. |
| src/vs/sessions/contrib/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Expands tests for dynamic session types, config resolution lifecycle, and config forwarding to chat. |
| src/vs/sessions/contrib/remoteAgentHost/common/remoteAgentHostSessionType.ts | Introduces helper to build remote session type IDs consistently across boundaries. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Discovers session types from rootState agents; implements dynamic config resolve/completions; forwards resolved config on send. |
| src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Registers remote agents dynamically (no hard-coded allowlist) and improves output-channel wiring. |
| src/vs/sessions/contrib/localAgentHost/test/browser/localAgentHostSessionsProvider.test.ts | Expands tests for local dynamic session types, config resolution lifecycle, type switching, and config forwarding. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts | Discovers session types from rootState (with contribution fallback), implements dynamic config resolve/completions, forwards resolved config on send. |
| src/vs/sessions/contrib/localAgentHost/browser/localAgentHost.contribution.ts | Registers/updates working-directory resolvers for dynamic local agent-host session types. |
| src/vs/sessions/contrib/chat/browser/sessionTypePicker.ts | Refreshes available types when providers advertise session type changes at runtime. |
| src/vs/sessions/contrib/chat/browser/newChatViewPane.ts | Disables send while session config is not “ready”; watches providers for config changes. |
| src/vs/sessions/contrib/chat/browser/media/agentHostSessionConfigPicker.css | Adds minimal styling for the session config picker container. |
| src/vs/sessions/contrib/chat/browser/agentHostSessionConfigPicker.ts | New schema-driven config picker UI (including dynamic completions) for new sessions. |
| src/vs/sessions/common/agentHostSessionWorkspace.ts | Adjusts workspace label formatting; removes repository “detail” usage. |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Updates mock agent service to implement new config RPCs. |
| src/vs/platform/agentHost/test/node/protocol/testHelpers.ts | Allows starting protocol test server with optional --quiet. |
| src/vs/platform/agentHost/test/node/protocol/sessionConfig.integrationTest.ts | Adds protocol integration tests for resolve/completions + config persisted in state + configChanged merge. |
| src/vs/platform/agentHost/test/node/protocol/agentHostServer.integrationTest.ts | Adds an integration smoke test that the server starts with production services. |
| src/vs/platform/agentHost/test/node/mockAgent.ts | Adds config schema + completions behavior to the mock/scripted mock agents. |
| src/vs/platform/agentHost/test/node/copilotGitProject.test.ts | Refactors tests to use the new git-service abstraction (no real git subprocess). |
| src/vs/platform/agentHost/test/node/copilotAgent.test.ts | Adds unit coverage for Copilot worktree root/branch/name conventions and length constraints. |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Adds coverage that createSession persists resolved config into live session state. |
| src/vs/platform/agentHost/test/node/agentHostGitService.test.ts | Adds unit coverage for branch completion ordering/filtering. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Forwards config into createSession; exposes resolve/completions RPCs. |
| src/vs/platform/agentHost/node/copilot/copilotGitProject.ts | Moves git discovery onto IAgentHostGitService. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Implements resolve/completions for config; creates/removes worktrees for “worktree isolation”; improves shutdown/cleanup. |
| src/vs/platform/agentHost/node/agentService.ts | Resolves/stores session config on creation; implements resolve/completions RPCs at the service layer. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Registers IAgentHostGitService for the server process. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Registers IAgentHostGitService for the utility process. |
| src/vs/platform/agentHost/node/agentHostGitService.ts | New git subprocess wrapper + branch completion helper. |
| src/vs/platform/agentHost/electron-browser/remoteAgentHostProtocolClient.ts | Forwards config into createSession; adds resolve/completions client RPCs. |
| src/vs/platform/agentHost/electron-browser/agentHostService.ts | Adds resolve/completions methods to the AgentHostService client proxy. |
| src/vs/platform/agentHost/common/state/sessionState.ts | Re-exports ISessionConfigState. |
| src/vs/platform/agentHost/common/state/protocol/version/registry.ts | Registers SessionConfigChanged as introduced in version 1. |
| src/vs/platform/agentHost/common/state/protocol/state.ts | Adds session config schema/value types and stores config on session state. |
| src/vs/platform/agentHost/common/state/protocol/reducers.ts | Adds reducer support for session/configChanged. |
| src/vs/platform/agentHost/common/state/protocol/messages.ts | Adds command-map entries for resolve/completions commands. |
| src/vs/platform/agentHost/common/state/protocol/commands.ts | Adds createSession config, resolveSessionConfig, and sessionConfigCompletions command types. |
| src/vs/platform/agentHost/common/state/protocol/actions.ts | Adds SessionConfigChanged action definition and exports in unions. |
| src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts | Updates generated unions + client-dispatchable map for configChanged. |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Updates protocol sync hash. |
| src/vs/platform/agentHost/common/agentService.ts | Extends public agent interfaces with config fields + resolve/completions APIs + branch hint key constant. |
| src/vs/platform/actionWidget/test/browser/actionList.test.ts | Adds unit tests for dynamic filter updates + stale-result suppression. |
| src/vs/platform/actionWidget/browser/actionList.ts | Adds optional async onFilter with cancellation to support dynamic filter-backed lists. |
Copilot's findings
- Files reviewed: 55/55 changed files
- Comments generated: 2
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts
Show resolved
Hide resolved
(Written by Copilot)
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
The merge-base changed after approval.
Adds Agent Host session configuration support for new session creation, including protocol plumbing, dynamic schema-driven pickers in the Agents window, config forwarding into Agent Host session creation, and Copilot worktree/branch setup based on resolved config.
Validation run:
(Written by Copilot)
Fix #305325